Skip to content

Conversation

nate-chandler
Copy link
Contributor

When the frontend flag -enable-experimental-lexical-lifetimes is passed, arguments of non-trivial, non-address types get lexical borrow scopes. The borrow scope begins in the function prolog. Usages of the arguments are actually usages of the borrowed value. The borrow scope is ended when the function's scope ends.

@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Oct 1, 2021

Build failed
Swift Test Linux Platform
Git Sha - 01476a74a0ada48f430d3ae6e11c3e66baf2cde2

Previously the declaration and definition of EndBorrowCleanup were both
within SILGenExpr.cpp.  That prevented the usage of cleanups which end
borrow scopes within other files.  Here, the declaration is moved to
Cleanup.h.  The necessary changes are made to SILGenExpr.cpp to keep the
definition of member functions in place.
Previously, tests for the generation of lexical borrow scopes when
-enable-experimental-lexical-lifetimes is passed had been dumped into
the file testing the creation of all borrow scopes.  Here, the file
containing tests on general borrow scopes is reverted to its original
state and a new file dedicated to lexical lifetimes is added.
Subsequent tests for SILGen's creation of lexical lifetimes will go into
that new file.
When the frontend flag -enable-experimental-lexical-lifetimes is passed,
arguments of non-trivial, non-address types get lexical borrow scopes.
The borrow scope begins in the function prolog.  Usages of the arguments
are actually usages of the borrowed value.  The borrow scope is ended
when the function's scope ends.
@nate-chandler nate-chandler force-pushed the lexical_lifetimes/silgen_argument_lifetimes branch from 01476a7 to 29faebf Compare October 1, 2021 01:33
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like basically the right idea

@nate-chandler
Copy link
Contributor Author

@swift-ci please clean test windows platform

1 similar comment
@nate-chandler
Copy link
Contributor Author

@swift-ci please clean test windows platform

@nate-chandler nate-chandler merged commit 814d583 into swiftlang:main Oct 1, 2021
@nate-chandler nate-chandler deleted the lexical_lifetimes/silgen_argument_lifetimes branch October 1, 2021 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants